//
//  TranferFinishCell.m
//  PigMarket
//
//  Created by 张敬 on 2019/8/21.
//  Copyright © 2019年 pigmarket.oc. All rights reserved.
//

#import "TranferFinishCell.h"

@implementation TranferFinishCell

- (void)setupUI{
    
    self.backgroundColor = KWhiteColor;
    
    [self.contentView addSubview:self.pigTypeTipLab];
    [self.contentView addSubview:self.pigTypeNOLab];
    [self.contentView addSubview:self.pigTypePriceLab];
    
    
    [self.contentView addSubview:self.buyTipLab];
    [self.contentView addSubview:self.nicknameLab];
    [self.contentView addSubview:self.shopIcon];
    [self.contentView addSubview:self.ageLab];
    [self.contentView addSubview:self.timeLab];
    
    
}

- (void)setupLayout
{
    
    
    [self.pigTypeTipLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(15);
        make.right.mas_equalTo(-100);
        make.height.mas_equalTo(21);
    }];
    
    [self.pigTypeNOLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.pigTypeTipLab.mas_bottom).offset(4);
        make.right.mas_equalTo(-100);
        make.height.mas_equalTo(18);
    }];
    
    [self.pigTypePriceLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(24);
        make.right.mas_equalTo(-15);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(20);
    }];

    
    CAShapeLayer *line = [CAShapeLayer layer];
    line.fillColor = UIColorFromRGB(0xF9F9F9).CGColor;
    UIBezierPath *path = [UIBezierPath bezierPathWithRect:CGRectMake(15, 73, KScreenWidth -15, 1)];
    line.path = path.CGPath;
    [self.contentView.layer addSublayer:line];
    
    [self.buyTipLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.pigTypeNOLab.mas_bottom).offset(31);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(20);
    }];
    
    [self.timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.buyTipLab.mas_bottom).offset(5);
        make.width.mas_equalTo(200);
        make.height.mas_equalTo(18);
    }];
    
    [self.shopIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15);
        make.top.mas_equalTo(89);
        make.width.mas_equalTo(42);
        make.height.mas_equalTo(42);
    }];
    
    [self.nicknameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-69);
        make.top.mas_equalTo(91);
        make.width.mas_equalTo(200);
        make.height.mas_equalTo(20);
    }];
    
    
    [self.ageLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-69);
        make.top.mas_equalTo(self.nicknameLab.mas_bottom).offset(3);
        make.width.mas_equalTo(200);
        make.height.mas_equalTo(17);
    }];
    
    
    
    self.pigTypeTipLab.text = @"五花肉";
    self.pigTypeNOLab.text = @"HT-02";
    
    self.pigTypePriceLab.text = @"¥216";
    
}



#pragma mark - setter methods

#pragma mark - getter methods

- (UILabel *)pigTypeTipLab{
    
    if (! _pigTypeTipLab){
        _pigTypeTipLab = [UILabel makeLabelWithText:@"" textColor:UIColorFromRGB(0x333333) font:mFont(15) textAliment:0];
    }
    return _pigTypeTipLab;
}


- (UILabel *)pigTypeNOLab{
    
    if (!_pigTypeNOLab){
        _pigTypeNOLab = [UILabel makeLabelWithText:@"" textColor:UIColorFromRGB(0xB2B2B2) font:mFont(13) textAliment:0];
    }
    return _pigTypeNOLab;
}


- (UILabel *)pigTypePriceLab{
    
    if (!_pigTypePriceLab){
        _pigTypePriceLab = [UILabel makeLabelWithText:@"" textColor:mMainColor font:mMediumFont(17) textAliment:2];
    }
    return _pigTypePriceLab;
}



- (UILabel *)ageLab{
    
    if (!_ageLab){
        _ageLab = [UILabel makeLabelWithText:@"年龄：18" textColor:UIColorFromRGB(0xB2B2B2) font:mFont(12) textAliment:2];
    }
    return _ageLab;
}

- (UILabel *)buyTipLab{
    
    if (!_buyTipLab){
        _buyTipLab = [UILabel makeLabelWithText:@"购买人" textColor:UIColorFromRGB(0xB2B2B2) font:mFont(14) textAliment:0];
    }
    return _buyTipLab;
}

- (UILabel *)timeLab{
    
    if (!_timeLab){
        _timeLab = [UILabel makeLabelWithText:@"购买时间：" textColor:UIColorFromRGB(0xB2B2B2) font:mFont(13) textAliment:0];
    }
    return _timeLab;
}


- (UILabel *)nicknameLab{
    
    if (!_nicknameLab){
        _nicknameLab = [UILabel makeLabelWithText:@"呆萌小猪宝" textColor:UIColorFromRGB(0x343434) font:mFont(14) textAliment:2];
    }
    return _nicknameLab;
}


- (UIImageView *)shopIcon{
    
    if (!_shopIcon) {
        _shopIcon = [UIImageView new];
        _shopIcon.backgroundColor = KRedColor;
        
        [self addShadowAndCircleCorner:_shopIcon.layer corner:21];
    }
    return _shopIcon;
}


@end
